package com.sss.hloster0101;

public class Teacher {

	// 属性
	private String teaName;
	private int teaAge;
	private String teaSex;
	private String courseName;

	// 构造方法
	/**
	 * 自定义的构造方法
	 * 
	 * @param teaName
	 * @param teaAge
	 * @param teaSex
	 * @param courseName
	 */
	public Teacher(String teaName, int teaAge, String teaSex, String courseName) {
		// 调用的默认的构造方法
		// this调用构造方法时，需要放在首行
		this();
		// super();
		System.out.println("执行了带有四个参数的自定义的构造方法。。。");
		this.teaName = teaName;
		this.teaAge = teaAge;
		this.teaSex = teaSex;
		this.courseName = courseName;
	}

	/**
	 * 因为有了自定义的构造方法，则jvm提供的构造方法失效，需要将默认的构造方法显示出来
	 */
	public Teacher() {
		System.out.println("执行了默认的构造方法。。。。");
	}

	// 行为方法
	/**
	 * 方法重载
	 */
	public void doTeaching() {
		System.out.println(this.getTeaName() + "  is teaching " + this.getcourseName() + "课程！");
	}

	/**
	 * 
	 * 方法重载：个数不同
	 */
	private void doTeaching(int num) {
		System.out.println(this.getTeaName() + "  is teahing" + num + "课程");
	}

	/**
	 * 方法重载：类型不同
	 * 
	 * @return
	 */
	public void doTeaching(String where) {
		System.out.println(this.getTeaName() + "  is teaching  " + this.getcourseName() + "课程      at  " + where);
	}

	/**
	 * 方法重载：个数不同
	 * 
	 * @return
	 */
	public void doTeaching(String where, int sum) {
		System.out.println(this.getTeaName() + " is teaching  " + this.getcourseName() + " 课程    at " + where);
	}

	/**
	 * 方法重载，顺序不同
	 * 
	 * @return
	 */
	public void doTeaching(int sum, String where) {
		System.out.println(
				this.getTeaName() + "  is teaching  " + sum + "门" + this.getcourseName() + "课程      at " + where);
	}

	/**
	 * 方法重载：个数不同，类型不同
	 * 
	 * @return
	 */
	public void doTeaching(String schoolName, String where) {
		System.out.println(this.getTeaName() + " is teaching  " + this.getcourseName() + "at" + where);
	}

	/**
	 * 方法重载：顺序不同【本质是：顺序相同，参数名不同而已】
	 * 
	 * @param wh
	 * @param num
	 */
	/*
	 * public void doTeaching(String where, String shoolName) {
	 * System.out.println(this.getTeaName() + "is teaching " + this.getCourseName()
	 * + " at " + where); }
	 */
	/**
	 * 变长参数：
	 * 
	 * @return
	 */
	public void doTeaching(String where, String... shoolName) {
		System.out.println("变长参数方法：");
		System.out.println(this.getTeaName() + "  is teaching " + this.getcourseName() + "  at  " + where);
		// 边长参数的使用
		if (shoolName != null) {
			for (String string : shoolName) {
				System.out.print(string + " ");
			}
			System.out.println();
		}
	}

	/**
	 * 变长参数和数组类型的参数，二者不构成重载；【把变长参数类型改变为数组类型，不构成重载】
	 * 
	 * @param where
	 * @param shoolName
	 */
//	public void doTeaching(String where, String[] shoolName) {
//		System.out.println("变长参数方法：");
//		System.out.println(this.getTeaName() + "is teaching " + this.getCourseName() + " at " + where);
//		// 变长参数的使用
//		if (shoolName != null) {
//			for (String string : shoolName) {
//				System.out.print(string + " ");
//			}
//			System.out.println();
//		}
//	}
	/**
	 * 变长参数
	 * 
	 * @return
	 */
	public void doTeaching(String where, int num, int stus, String[] shoolName) {
		System.out.println("数组类型的参数方法：");
		System.out.println(this.getTeaName() + "  is teaching " + this.getcourseName() + "  at  " + where);
		// 边长参数的使用
		if (shoolName != null) {
			for (String string : shoolName) {
				System.out.print(string + " ");
			}
			System.out.println();
		}
	}

	// getter/setter方法接口
	public String getTeaName() {
		return teaName;
	}

	public void setTeaName(String teaName) {
		this.teaName = teaName;
	}

	public int getTeaAge() {
		return teaAge;
	}

	public void setTeaAge(int teaAge) {
		this.teaAge = teaAge;
	}

	public String getTeaSex() {
		return teaSex;
	}

	public void setTeaSex() {
		this.teaSex = teaSex;
	}

	public String getcourseName() {
		return courseName;
	}

	public void setCourseName(String courseName) {
		this.courseName = courseName;
	}
}
